from collections import defaultdict
def magic_cost_inner(n, edges):
    adjs = [[] for _ in range(n)]
    for u, v in edges:
        adjs[u].append(v)
        adjs[v].append(u)

    dp = [[defaultdict(int) for _ in range(3)] for _ in range(n)]
    for u in range(n):
        dp[u][0][0] = 2
        dp[u][1][0] = 1
        dp[u][2][0] = 0

    def update(u, v):
        d = [defaultdict(int) for _ in range(3)]
        for s1 in range(3):
            for pt1, cnt1 in dp[u][s1].items():
                for s2 in range(3):
                    for pt2, cnt2 in dp[v][s2].items():
                        if s1 == 0 and s2 == 0:
                            pt = pt1 + pt2
                            d[0][pt] += cnt1 * cnt2
                        elif s1 == 0 and s2 == 1:
                            pt = pt1 + pt2 + 1
                            d[0][pt] += cnt1 * cnt2
                        elif s1 == 0 and s2 == 2:
                            pt = pt1 + pt2 - 1
                            d[0][pt] += cnt1 * cnt2
                        elif s1 == 1 and s2 == 0:
                            pt = pt1 + pt2
                            d[1][pt] += cnt1 * cnt2
                        elif s1 == 2 and s2 == 0:
                            pt = pt1 + pt2
                            d[2][pt] += cnt1 * cnt2
                        elif s1 == 1 and s2 == 1:
                            pt = pt1 + pt2
                            d[2][pt] += cnt1 * cnt2
                        elif s1 == 1 and s2 == 2:
                            pt = pt1 + pt2
                            d[1][pt] += cnt1 * cnt2
                        elif s1 == 2 and s2 == 1:
                            pt = pt1 + pt2
                            d[1][pt] += cnt1 * cnt2
                        elif s1 == 2 and s2 == 2:
                            pt = pt1 + pt2
                            d[2][pt] += cnt1 * cnt2
        dp[u] = d

    root = 0
    visited = [False] * n
    def dfs_visit(u):
        visited[u] = True
        for v in adjs[u]:
            if not visited[v]:
                dfs_visit(v)
                update(u, v)
    dfs_visit(root)

    # for u in range(n):
    #     print(u)
    #     for pt in range(-n, n + 1):
    #         print('%4d' % pt, end='')
    #     print()
    #     for s in range(3):
    #         for pt in range(-n, n+1):
    #             print('%4d'%dp[u][s][pt], end='')
    #         print()
    #     print()

    result = 0
    for s in range(3):
        for pt, cnt in dp[root][s].items():
            pt_ = pt
            if s == 1:
                pt_ = pt + 1
            elif s == 2:
                pt_ = pt - 1
            result += cnt * max(0, pt_)
    return result


def magic_cost(n, edges):
    edges_ = []
    for u, v in edges:
        edges_.append([u-1, v-1])
    res1 = magic_cost_inner(n, edges_)
    return res1 * 3


def test():
    res = magic_cost(3, [[2,1], [1,3]])
    print(res)


def main():
    n = int(input())
    edges = []
    for _ in range(n-1):
        a, b = input().split()
        a, b = int(a), int(b)
        edges.append([a, b])
    result = magic_cost(n, edges)
    print(result)


if __name__ == '__main__':
    main()
